<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>GPU Feature Testing: WebGL</title>
<script>
var frameCount = 0;
var gl = null;

function init() {
  var canvas = document.getElementById("da-canvas");
  if (!canvas)
    return;
  try {
    gl = canvas.getContext("webgl");
  } catch(e) {}
  if (!gl) {
    try {
      gl = canvas.getContext("experimental-webgl");
    } catch(e) {}
  }
}

function runTest() {
  init();
  if (gl)
    window.requestAnimationFrame(draw);
  else
    endTest();
}

function draw() {
  frameCount++;
  gl.viewport(0, 0, 10, 10);
  gl.clearColor(1.0/frameCount, 0.0, 0.0, 1.0);
  gl.clear(gl.COLOR_BUFFER_BIT);
  if (frameCount == 6) {
    endTest();
  } else {
    window.requestAnimationFrame(draw);
  }
}

function endTest() {
  domAutomationController.send("FINISHED");
}
</script>
</head>
<body onload="runTest()">
WebGL should trigger GPU process launch if it is allowed.
<canvas id="da-canvas" width="10" height="10"></canvas>
</body>
</html>
